Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
rollup-plugin-esbuild
Advanced tools
Readme
💛 You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.
esbuild is by far one of the fastest TS/ESNext to ES6 compilers and minifier, this plugin replaces rollup-plugin-typescript2
, @rollup/plugin-typescript
and rollup-plugin-terser
for you.
yarn add esbuild rollup-plugin-esbuild --dev
In rollup.config.js
:
import esbuild from 'rollup-plugin-esbuild'
export default {
plugins: [
esbuild({
// All options are optional
include: /\.[jt]sx?$/, // default, inferred from `loaders` option
exclude: /node_modules/, // default
sourceMap: true, // default
minify: process.env.NODE_ENV === 'production',
target: 'es2017', // default, or 'es20XX', 'esnext'
jsx: 'transform', // default, or 'preserve'
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
// Like @rollup/plugin-replace
define: {
__VERSION__: '"x.y.z"',
},
tsconfig: 'tsconfig.json', // default
// Add extra loaders
loaders: {
// Add .json files support
// require @rollup/plugin-commonjs
'.json': 'json',
// Enable JSX in .js files too
'.js': 'jsx',
},
}),
],
}
include
and exclude
can be String | RegExp | Array[...String|RegExp]
, when supplied it will override default values.jsx
, jsxDev
, jsxFactory
, jsxFragmentFactory
and target
options from your tsconfig.json
as default values.There are serveral ways to generate declaration file:
tsc
with emitDeclarationOnly
, the slowest way but you get type checking, it doesn't bundle the .d.ts
files.rollup-plugin-dts
which generates and bundle .d.ts
, also does type checking.api-extractor
by Microsoft, looks quite complex to me so I didn't try it, PR welcome to update this section.Use this with rollup-plugin-vue-jsx:
import vueJsx from 'rollup-plugin-vue-jsx-compat'
import esbuild from 'rollup-plugin-esbuild'
export default {
// ...
plugins: [
vueJsx(),
esbuild({
jsxFactory: 'vueJsxCompat',
}),
],
}
If you only want to use this plugin to minify your bundle:
import { minify } from 'rollup-plugin-esbuild'
export default {
plugins: [minify()],
}
You can use this plugin to pre-bundle dependencies using esbuild and inline them in the Rollup-generated bundle:
esbuild({
optimizeDeps: {
include: ['vue', 'vue-router'],
},
})
This eliminates the need of @rollup/plugin-node-modules
and @rollup/plugin-commonjs
.
Note that this is an experimental features, breaking changes might happen across minor version bump.
TODO: Maybe we can scan Rollup input files to get a list of deps to optimize automatically.
MIT © EGOIST (Kevin Titor)
FAQs
**💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).**
We found that rollup-plugin-esbuild demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).